package com.woniu.controller;


import com.woniu.model.Result;
import com.woniu.service.FootprintService;
import com.woniu.service.util.JwtUtil;
import com.woniu.service.vo.TestPageVo;
import com.woniu.service.vo.TestVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author D
 * @since 2023-03-27 08:24:57
 */
@RestController
@RequestMapping("/footprint")
public class FootprintController {

    @Autowired
    private FootprintService footprintService;
    /**
     * 获取用户足迹信息
     *
     * @param token       用户令牌
     * @param currentPage 当前页码
     * @param pageSize    页面大小
     * @return 用户足迹信息
     */
    @ApiOperation("足迹")
    @RequestMapping("/getFootprints")
    public Result<TestPageVo<TestVo>> footprints(String token, Integer currentPage, Integer pageSize) {
        Long userCode = Long.valueOf(JwtUtil.parseValueWithoutException(token, "token"));
        TestPageVo<TestVo> footprintPageVo = footprintService.pageFootprint(userCode, currentPage, pageSize);
        return Result.successResult(footprintPageVo);
    }

}

